<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>我的订单</title>
	<%--静态包含base标签，css样式，JQuery文件--%>
	<%@include file="/pages/common/head.jsp"%>
	<script type="text/javascript">
		$(function () {
			$(".receiveItem1").click(function () {
				return confirm("你确定要收货订单号为:"+$(this).parent().parent().find("td:first").text()+"的商品吗？")
			});
			$(".receiveItem2").click(function () {
				return confirm("你确定要收货订单号为:"+$(this).parent().parent().find("td:first").text()+"的商品吗?\n"+"该商品还没有发货哦！")
			});
		})
	</script>
<style type="text/css">
	h1 {
		text-align: center;
		margin-top: 200px;
	}
</style>
</head>
<body>
	
	<div id="header">
			<img class="logo_img" alt="" src="../../static/img/logo.gif" >
			<span class="wel_word">我的订单</span>
		<%--静态包含登录成功之后的菜单--%>
		<%@include file="/pages/common/login_success_menu.jsp"%>
	</div>
	
	<div id="main">
		
		<table>
			<tr>
				<td>订单号</td>
				<td>日期</td>
				<td>金额</td>
				<td>状态</td>
				<td>详情</td>
				<td>收货</td>
			</tr>
			<c:forEach items="${requestScope.Myorders}" var="myOrder">
				<tr>
					<td>${myOrder.orderId}</td>
					<td><fmt:formatDate value="${myOrder.createTime}" pattern="yyyy.MM.dd"/></td>
					<td>${myOrder.price}</td>
					<td>
						<c:if test="${myOrder.status eq 0}">未发货</c:if>
						<c:if test="${myOrder.status eq 1}">已发货</c:if>
						<c:if test="${myOrder.status eq 2}">已签收</c:if>
					</td>
					<td><a href="orderServlet?action=showOrderDetails&orderId=${myOrder.orderId}">查看详情</a></td>
					<td>
						<c:if test="${myOrder.status==1}">
							<a class="receiveItem1"  href="orderServlet?action=receiveOrder&orderId=${myOrder.orderId}">确认收货</a>
						</c:if>
						<c:if test="${myOrder.status==0}">
							<a class="receiveItem2"  href="orderServlet?action=receiveOrder&orderId=${myOrder.orderId}">确认收货</a>
						</c:if>
						<c:if test="${myOrder.status==2}">
							<a style="color:gray">确认收货</a>
						</c:if>
					</td>
				</tr>
			</c:forEach>

			
			<%--<tr>
				<td>2015.04.20</td>
				<td>20.00</td>
				<td>已发货</td>
				<td><a href="#">查看详情</a></td>
			</tr>	
			
			<tr>
				<td>2014.01.23</td>
				<td>190.00</td>
				<td>已完成</td>
				<td><a href="#">查看详情</a></td>
			</tr>		--%>
		</table>
		
	
	</div>

	<%--静态包含页脚内容--%>
	<%@include file="/pages/common/footer.jsp"%>
</body>
</html>